<?php
// +----------------------------------------------------------------------
// | Tplay [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://tplay.pengyichen.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 听雨 < 389625819@qq.com >
// +----------------------------------------------------------------------


namespace app\home\model;

use \think\Model;
class ArticleCate extends Model
{

	public function getArticleList()
    {
        //关联文章表
        return $this->hasMany('Article','article_cate_id');
    }
    public function  _list($article_cate_id,$page=10){
        $article = ArticleCate::get($article_cate_id);
        if(empty($article)){
            return false;
        }
        $list = $article->getArticleList()->where('status',1)->paginate($page);
        $result['cat']= $article;
        $result['list'] = $list;
        return $result;
    }




}
